﻿using System;
using System.Collections.Generic;
using System.Text;

using GameServer.Virtual_Objects.Room;
using GameServer.Virtual_Objects.User;
using GameServer.Networking.Packets;

namespace GameServer.Networking.Handlers
{
    class HANDLE_ROOM_BOMB : PacketHandler
    {
        public override void Handle(Virtual_Objects.User.virtualUser User)
        {
            try
            {
                int Type = int.Parse(getNextBlock());
                virtualRoom Room = User.Room;
                if (Room.getSide(User) == 1 && User.Weapon == 118) // NIU
                {
                    if (Room.bombPlanted == false) User.disconnect();
                    Room.bombDefused = true;
                    Room.newRound(Room.getSide(User));
                    Room.cNIUExplosivePoints += 12;
                    Room.cNiuRounds += 1;
                }
                else if (Room.getSide(User) == 0 && User.Weapon == 91) // Derb
                {
                    Room.bombPlanted = true;
                    Room.cDerbExplosivePoints += 6;
                    Room.RoundTimeLeft = 47000;
                }
                Room.send(new PACKET_BOMB(getAllBlocks()));
            }
            catch (Exception ex)
            {
                Log.WriteError("ROOM Bomb error: " + ex.Message);
            }
        }
    }
}
